package com.web_bloks.storage.client;

import java.util.Vector;

/**
 * 
 * @author Jean-Lou Dupont
 *
 */
public class SimpleRecentList implements IRecentList {

	Vector<RecentListEntry> rl = new Vector<RecentListEntry>();
	
	String last = null;
	
	/*****************************************
	 * 
	 *****************************************/
	public SimpleRecentList() {
		super();
	}

	/*****************************************
	 * IRecentList 
	 *****************************************/
	
	/**
	 * Let the caller do the trimming if required
	 * i.e. the parameter 'count' is not taken into account
	 */
	public Vector<RecentListEntry> getLatest(int count) {
		
		return rl;
	}

	/**
	 * 
	 */
	public boolean insertEntry(String entry, String meta) {
		
		if ( last != entry )
			rl.add( new RecentListEntry(entry, meta) );
	
		last = entry;
		
		return true;
	}

	
}//END